<?php
/**
 *@author Connor <caokang@foxmail.com>
 *@todo
 *@link www.zeevin.com
 */
?>
<div class="title">
	<h3>发信箱--发送信件</h3>
	<ul>
		<li><a href="#" title="收信箱">收信箱</a></li>
		<li class="current"><a href="#" title="发信箱">发信箱</a></li>
	</ul>
</div>
<div class="main_content">
	<div class="write">
		<?php echo CHtml::beginForm(array('pm/new'),'post',array('id'=>'pm_save'));?>
			<div class="write_to">
				<?php echo CHtml::activeHiddenField($model, 'to_uid',array('value'=>$_GET['tid']));?>
				<div class="left">寄给：<?php echo $receiver->nickname,'，',Utils::getAge($receiver->birth),'，',Area::getName($receiver->city_id);?></div>
				<div class="right"><a href="?r=space&id=<?php echo $_GET[tid];?>"><img src="<?php echo Utils::getAvatar($receiver->avatar);?>" width="56" height="56" alt="<?php echo $receiver->nickname;?>"/></a></div>
			</div>
			<div class="write_title">
				<label>标题：</label>
				<?php echo CHtml::activeTextField($model, 'subject',array('maxlength'=>255));?>
			</div>
			<div class="write_content">
				<label>正文：</label>
				<?php echo CHtml::activeTextArea($model, 'content')?>
			</div>
			<input type="reset" style="display:none;" /> 
			<div class="view_operation"> <span class="reply2" onclick="$('#pm_save').submit();">好了，寄出去</span><span class="revoke">撤销</span></div>
		<?php echo CHtml::endForm();?>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var options = {
beforeSubmit:function(){if(validator_status){return false;}},
     success: function(data) { 
            var msg='信件发送失败';
            data = $.parseJSON(data);
            
            $('#topmsg').html(data.desc)
            $('#showmsg').show();
            showDialog();
            setTimeout(function(){location.reload();},1000);
        }
};
$('#pm_save').ajaxForm(options);

$('.revoke').click(function(){
	$('input[type=reset]').click();
})
})
</script>